home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / tjgold.zip / INSTALL.004 / FGUSER03.TXT < prev    next >
Text File  |  1995-05-29  |  29KB  |  624 lines

  1.                               General Principles
  2.  
  3.                                     "Nay, but you, who do not love her.
  4.                                      Is she not pure gold my mistress."
  5.                                                 Browning, 1812-1889
  6.  
  7. The Unit Variables
  8.  
  9.           Gold is designed such that with a few lines of code, you can
  10.      achieve a great deal of functionality. For example, with just a
  11.      single line of code, you can display a file input dialog box
  12.      showing files, directories, etc. This simplicity is possible
  13.      because Gold has a rich set of default properties; for example, the
  14.      color of the push buttons and the shadow style of windows.
  15.  
  16.           If you don't like the defaults, you can change them! Each unit
  17.      in Gold contains a special record that defines defaults pertinent
  18.      to the unit. The name of this record follows a standard convention:
  19.      the name begins with the unique characters in the unit name, and
  20.      ends with the four characters VARS. For example, the GOLDDIR.PAS
  21.      unit contains the global variable DIRVARS, the GOLDCAL.PAS unit
  22.      contains the global variable CALVARS, and the GOLDMENU.PAS unit
  23.      contains the global variable MENUVARS. And so on.
  24.  
  25.           You can modify elements of these records to customize the
  26.      appearance and behavior of Gold. For example, you can redefine the
  27.      keystrokes used to navigate a calendar by changing the NextMKey,
  28.      PrevMKey, NextYKey and PrevYKey elements:
  29.  
  30.           CalVars.NextMKey := 360;
  31.           CalVars.PrevMKey := 361;
  32.           CalVars.NextYKey := 362;
  33.           CalVars.PrevYKey := 363;
  34.  
  35.           Similarly, the default calculator style can be customized by
  36.      assigning a value to the CalcVars' element Style, as follows:
  37.  
  38.           CalcVars.Style := CalcWide;
  39.  
  40.           Throughout the user's guide, references are made to relevant
  41.      elements of the global variables defined in each unit. Just
  42.      remember that we have tried to make Gold very flexible and if
  43.      you're not sure how to customize the properties of a Gold
  44.      component, look at the appropriate XXXVARS variable in the unit
  45.      source code, and see whether there is a relevant element that you
  46.      can customize.
  47.  
  48.           A different approach is used for customizing colors. Refer to
  49.      the section Customizing Display Colors.
  50.  
  51. Compiler Directives and GOLDFLAG.INC
  52.  
  53.           Every unit in Gold has an include statement to include the
  54.      file GOLDFLAG.INC. This file is designed to specify all the common
  55.      compiler directives that you want to apply to every unit in your
  56.      program.
  57.  
  58.           The compiler directives added to your main program apply only
  59.      to that module and not to any of the units used by that program. So
  60.      if you wanted to ensure that a specific compiler directive is
  61.      operative in every unit, you would have to edit every units source
  62.      code and add the appropriate directive. Yes, you could add them to
  63.      the IDE options menu, but if you work on multiple projects, it is a
  64.      chore making sure that you have the appropriate directives set. The
  65.      most foolproof way is to set the directives in an include file.
  66.  
  67.           Whenever you develop a program using Gold, you should add an
  68.      include directive to the main program and any other units you
  69.      develop, as follows:
  70.  
  71.           {$I GOLDFLAG.INC}
  72.  
  73.           Any compiler directives you set in the file GOLDFLAG.INC will
  74.      then affect your code and the Gold code. The GOLDFLAG.INC file
  75.      contains a set of master conditional compiler directives named
  76.      FINAL, OVERLAY, FLOAT, FLOATEM, NOVGACHARS, CUTANDPASTE, WORDWRAP
  77.      and TTT5.  By enabling or disabling these master directives, you
  78.      are setting families of specific directives. For example, by
  79.      enabling the FINAL directive, you are indirectly setting the state
  80.      of the range checking, stack checking, debug, and linker
  81.      directives. These master directives are located at the top of
  82.      GOLDFLAG.INC, and by default, some are enabled and others are
  83.      disabled. In the disabled state, the $DEFINE directive is broken up
  84.      with spaces, e.g. { $ DEFINE OVERLAY}
  85.  
  86.      To activate a directive, simply remove the leading spaces, e.g.
  87.  
  88.      {$DEFINE OVERLAY}
  89.  
  90.           Listed below are the default settings of the master compiler
  91.      directives:
  92.  
  93.           { $ DEFINE FINAL}
  94.           { $ DEFINE FLOAT}
  95.           { $ DEFINE FLOATEM}
  96.           { $ DEFINE OVERLAY}
  97.           { $ DEFINE NOVGACHARS}
  98.           { $ DEFINE TTT5}
  99.           {$DEFINE CUTANDPASTE}
  100.           {$DEFINE WORDWRAP}
  101.  
  102.           As the listing shows, all the major directives are disabled,
  103.      and the two word processing directives are enabled. The purpose of
  104.      the individual compiler directives are discussed below.
  105.  
  106. FINAL
  107.  
  108.           During program development it is a good idea to switch on
  109.      range checking and stack checking, etc. These directives keep you
  110.      honest and allow the compiler to quickly identify potential
  111.      problems. For example, if you try to assign a value of 300 to a
  112.      byte, the problem will be identified with a range error at
  113.      run-time. The bad news is that programs compiled in the check
  114.      everything state tend to be slower and larger than their carefree
  115.      brethren. So, once you have debugged and tested your program and
  116.      you are confident that the checking is no longer necessary, you
  117.      should switch off the appropriate directives.
  118.  
  119.           The FINAL compiler directive is designed to simplify this
  120.      task. During program development, you should disable the FINAL
  121.      compiler directive, and then enable it when you are ready to build
  122.      and distribute your production program.
  123.  
  124.           IMPORTANT NOTE: If you want to debug your program using the
  125.      internal or external debugger, you must disable the FINAL
  126.      directive.
  127.  
  128.           When FINAL is disabled, another directive CHECK is defined.
  129.      When CHECK is enabled, Gold uses some additional code to check that
  130.      sensible parameters are passed to procedures. For example, in
  131.      GoldDB checks are made to ensure that the specified Field number
  132.      exists.
  133.  
  134. FLOAT
  135.  
  136.           Gold supports extended reals. By default, Borland Pascal uses
  137.      6-byte reals, but using compiler directives, varying precision
  138.      reals can be used, i.e. Single, Double, Extended and Comp.
  139.  
  140.           If you want to use the higher precision reals, enable the
  141.      FLOAT compiler directive. Gold will automatically set the
  142.      appropriate compiler directives.
  143.  
  144.           When FLOAT is enabled, Gold supports all real types. When
  145.      FLOAT is disabled, all the real types are type-cast to the base
  146.      REAL type. In other words, you can still reference the types
  147.      SINGLE, DOUBLE, EXTENDED and COMP in your code, but they all appear
  148.      to the compiler as plain old REAL. The type-casting is performed by
  149.      the small unit GOLDREAL.PAS.
  150.  
  151.           If your program is compiled with FLOAT enabled and it is going
  152.      to be executed on a computer without a math co-processor installed,
  153.      the FLOATEM compiler directive (discussed next) must also be
  154.      enabled. Note that the GOLDHARD function MathChip will return true
  155.      if the system has a match co-processor installed.
  156.  
  157. FLOATEM
  158.  
  159.           Borland Pascal is capable of emulating an 8087 math
  160.      co-processor if the PC does not have one installed. Enable the
  161.      FLOAT and FLOATEM (short for float emulation) directives if you
  162.      want to use high precision reals on PCs without a math
  163.      co-processor.
  164.  
  165. OVERLAY
  166.  
  167.      Any of the Gold units can be overlaid.
  168.  
  169.           Borland Pascal requires that all overlaid units include the
  170.      {$O+} compiler directive, and that all procedures and
  171.      functions are compiled using the far calling method, i.e. they
  172.      are compiled in the {$F+} state. By activating the OVERLAY
  173.      directive in GOLDFLAG.INC, all the Gold units will be compiled
  174.      in the {$F+,$O+} state.
  175.  
  176.           To help you create programs with overlays, Gold includes the
  177.      template file GOLDOVR.PAS. When you need to overlay some Gold
  178.      units, you should make a copy of GOLDOVR.PAS to a new file, e.g.
  179.      ACCNTOVR.PAS. Then edit the name of the program overlay file
  180.      (default: PROGRAM.OVR) to reflect the name of the file which will
  181.      contain the compiled overlay code, e.g. ACCOUNTS.OVR.
  182.  
  183.           The USES statement of the main program must list the AccntOVR
  184.      file (or whatever name you gave the unit) before the Gold units
  185.      which are to be overlaid. For example:
  186.  
  187.           program AccountsPayable;
  188.           {ACCOUNTS.PAS}
  189.           {$F+}
  190.           USES OVERLAY,DOS,CRT,
  191.                AccntOVR, GoldFAST, GoldWIN, GoldIO;
  192.  
  193.           {$O GoldFAST}
  194.           {$O GoldWIN}
  195.           {$O GoldIO}
  196.  
  197.           begin
  198.              {.....}
  199.           end.
  200.  
  201.           In the example, by the time the program tries to load
  202.      GoldFAST, the overlay manager has already been installed (by
  203.      AccntOVR) and so the GoldFAST initialization section can be
  204.      successfully executed as an overlay.
  205.  
  206.           Review the demo program DEMOV1.PAS and its accompanying unit
  207.      DEMOV1UN.PAS to see these techniques in action.
  208.  
  209. NOVGACHARS
  210.  
  211.           One of the innovations in Gold is the ability, on VGA systems,
  212.      to use custom characters for drawing box borders, window icons and
  213.      the like (see the section Using Custom Characters below). The
  214.      support for custom characters is woven into the fabric of the
  215.      GoldFAST unit. If you have no intention of deploying these custom
  216.      characters in your applications, you can save code and data
  217.      resources by enabling the NOVGACHARS directive. Obviously, if this
  218.      directive is enabled, your program won't be able to use the special
  219.      drawing characters.
  220.  
  221. TTT5
  222.  
  223.           Many Gold developers have existing programs written with
  224.      TechnoJock's Turbo Toolkit version 5.0. Unfortunately, existing
  225.      programs cannot simply be ported to Gold by modifying the USES
  226.      statement to use the Gold units instead of the TTT units. The
  227.      reason? A number of fundamental changes (i.e. improvements!) were
  228.      made in the basic toolkit design. For example, all underscores were
  229.      removed from procedure and function names, and color attributes are
  230.      passed as a single (combined) byte rather than separate foreground
  231.      and background attributes.
  232.  
  233.           Although we recommend that you change your programs to use the
  234.      new naming and parameter conventions, we do recognize what a pain
  235.      this can be! By enabling the TTT5 direction in GOLDFLAG.INC, you
  236.      can get the best of both worlds, because Gold automatically
  237.      supports the majority of old-style function calls.
  238.  
  239.           For example, with TTT5 enabled, you could call
  240.      ActivateVisibleScreen or the old-style Activate_Visible_Screen.
  241.  
  242.           There is, however, a complication because Borland Pascal does
  243.      not allow two procedures to have the same name within a unit. In
  244.      many situations Gold has changed a procedure's parameters but used
  245.      the same name. For example, Gold WriteAT accepts four parameters:
  246.      the X,Y coordinate, the combined display attribute, and the string.
  247.      In TTT 5.0,  the same procedure accepted 5 parameters -- the
  248.      attribute was passed as a foreground and a background byte. Borland
  249.      Pascal doesn't allow two procedures to be named WriteAT. So, we
  250.      named the old-style procedure FBWriteAT; solving the naming problem
  251.      and giving an indication of the main difference between the
  252.      old-style procedure and its new counterpart.
  253.  
  254.           Refer to the GoldDust paper "Porting TTT Applications" if you
  255.      are trying to port an old TTT application to use Gold. This paper
  256.      lists all the old TTT 5.0 exported procedures, identifiying the
  257.      TTT5-directive equivalent along with the Gold equivalent.
  258.  
  259.           The GoldMEMO unit provides sophisticated text editing
  260.      capabilities including cut-and-paste and word-wrap. If you only
  261.      need a plain text editor, and don't need these features, you can
  262.      disable the features and reduce the program size by using the
  263.      CUTANDPASTE and WORDWRAP compiler directives.
  264.  
  265. CUTANDPASTE
  266.  
  267.           The CUTANDPASTE directive controls whether Gold will support
  268.      text cut-and-paste in the editing functions. Disable this directive
  269.      if you want to use an editor but don't need cut-and-paste; the
  270.      program will be smaller.
  271.  
  272. WORDWRAP
  273.  
  274.           The WORDWRAP directive controls whether Gold will support
  275.      automatic word-wrapping in the text editing functions. Disable this
  276.      directive if you want to use an editor but don't need word-wrap;
  277.      the program will be smaller.
  278.  
  279. Handling Errors
  280.  
  281.           Errors happen! As a developer you understand, more than most,
  282.      that errors can occur while a program is running.
  283.  
  284.           Gold will always try to deal with an error in an appropriate
  285.      way. When a program is compiled with the FINAL directive disabled,
  286.      Gold will alert you to errors (typically in a PromptOK message),
  287.      whether they are trivial or mind-blowingly important. However, when
  288.      the program is compiled with FINAL enabled, the user will not be
  289.      made aware of the error if the consequence of the error is probably
  290.      trivia. If the error is profound, (e.g. there is no memory left) a
  291.      dialog will be displayed to the user.
  292.  
  293.           All the Gold units that have the potential to fail at run-time
  294.      (which is the majority), have a function which can be called to
  295.      determine whether the last operation was a success. The name of the
  296.      function is LastXXXError, where XXX is the unique identifier in the
  297.      unit name, e.g. LastWINError, LastCALCError, etc. If you are
  298.      writing a commercial-quality application, you should always call
  299.      these last error functions when there is a chance that the last
  300.      operation failed.
  301.  
  302.           The following example shows how to test for an error in the
  303.      RunCalendar function:
  304.  
  305.           Answer := RunCalendar(TodayInJul,' A Calendar! ');
  306.           if LastCalError <> 0 then
  307.              promptOK(' Error ','Unable to display calendar')
  308.           else
  309.           begin
  310.              if CalVars.ChooseDay then
  311.              begin
  312.                 if Answer = 0 then
  313.                    PromptOK('','You escaped!')
  314.                 else
  315.                   PromptOK('',' You selected '
  316.                            +FancyDateStr(Answer,false,false));
  317.              end;
  318.           end;
  319.  
  320.           Refer to the Gold Reference manual for a complete list of all
  321.      the LastXXXError functions.
  322.  
  323. ERROR CUSTOMIZATION
  324.  
  325.           Most of the Gold units are organized so that international
  326.      users can replace the English error messages with local language
  327.      messages.
  328.  
  329.           The GoldMisc unit includes the following type declaration:
  330.  
  331.      ErrMsgFunc = function (Ecode:integer):string;
  332.  
  333.           To use custom error messages, all you need to do is create a
  334.      far procedure which is declared the same as the ErrMsgFunc defined
  335.      above. The function is passed an error code and should return a
  336.      string explaining the nature of the error. The following is an
  337.      extract of the English error messages in GoldMisc (by way of an
  338.      example):
  339.  
  340.           function MyMiscEMsg(ECode:integer): string;
  341.           {}
  342.           begin
  343.              case Ecode of
  344.                1001: MyMiscEMsg := 'Invalid drive.';
  345.                1002: MyMiscEMsg := 'Failure changing directory';
  346.                1003: MyMiscEMsg := 'Failure making directories';
  347.                else
  348.                   MyMiscEMsg := 'Internal Misc error';
  349.              end; {case}
  350.           end; { MyMiscEMsg }
  351.  
  352.           Having created a far procedure with the custom error messages,
  353.      you must then instruct Gold to use your function in place of the
  354.      standard message function. To do this, assign the procedure to the
  355.      local variable EmsgFunc which is stored in the XXXVARS record
  356.      (discussed in the first section of this chapter). The following
  357.      code fragment shows this technique being used to assign custom
  358.      messages for the GoldMISC unit:
  359.  
  360.           MiscVars.EMsgFunc := MyMiscEMsg;
  361.  
  362. Understanding Hooks
  363.  
  364.           Good though Gold is, there will be situations where Gold
  365.      doesn't meet your specific applications needs. In many cases, the
  366.      XXXVARS structure will provide you with ways to customize Gold. For
  367.      example, if you want change the window type for the prompt dialogs,
  368.      you could use the following statement to instruct Gold to use a
  369.      window style of 1:
  370.  
  371.      WinVars.PromptStyle := 1;
  372.  
  373.           In sophisticated applications, you might encounter some
  374.      behavior or characteristic which cannot be readily changed using
  375.      the above-mentioned technique. Hey, we can't think of everything!
  376.  
  377.           The solution to these truly custom needs lies in user-defined
  378.      hooks which interact with low-level internal routines. A hook is a
  379.      procedure or function which is called at strategic times during the
  380.      execution of an application. For example, a user-defined hook can
  381.      be called every time a user tries to leave an input field in a
  382.      form. Another example is a hook that is called every time a user
  383.      changes selections on a menu.
  384.  
  385.           In simple terms, a hook is a user-defined procedure which is
  386.      called by Gold whenever a specific event occurs. But a hook goes
  387.      beyond a simple notification event; a hook can actually change the
  388.      program behavior. For example, a form EnterFieldHook can redirect
  389.      focus (i.e. the highlighted field) to a different field, and a
  390.      character hook can replace the character Alt-A with the five
  391.      characters "APPLE".
  392.  
  393.           There are over 30 hooks scattered about the product. If you
  394.      find that a particular unit does not behave just how you would
  395.      like, review the Hook section in the appropriate chapter and see if
  396.      a hook will allow you to customize Gold's behavior.
  397.  
  398. CREATING A HOOK ROUTINE
  399.  
  400.           To take advantage of a hook, you must create a procedure or
  401.      function with the exact declaration of the hook. In other words,
  402.      the routine must be declared with the exact number and type of
  403.      passed parameters, and (in the case of function hooks) the function
  404.      must return the correct type. Refer to the specific documentation
  405.      for a clarification of each hook's declaration.
  406.  
  407.           You must create the procedure or function at the root level of
  408.      a program or unit, i.e. it must not be nested within a parent
  409.      procedure or function.
  410.  
  411.           The procedure must be declared as a far procedure. You can do
  412.      this by adding the far keyword on the procedure declaration line,
  413.      or by using the {$F+} compiler directive.
  414.  
  415.           The following hook is extracted from the demo program
  416.      DEMIO6.PAS and shows a hind hook being used in an IO form to
  417.      control whether field number 10 is enabled or disabled:
  418.  
  419.           {$F+}
  420.           procedure MyHindHook(CurrentField:byte;var Refresh:byte);
  421.           {}
  422.           begin
  423.              Refresh := RefreshNone;
  424.              if CurrentField = 9 then {radio button}
  425.              begin
  426.                 if (Cust.Radio = 4)
  427.                 and (FieldGetState(10) = FldOn) then
  428.                 begin
  429.                    FieldSetState(10,FldOff);
  430.                    Refresh := RefreshOthers;
  431.                 end
  432.                 else if (Cust.Radio <> 4)
  433.                 and not (FieldGetState(10) = FldOn) then
  434.                 begin
  435.                    FieldSetState(10,FldOn);
  436.                    Refresh := RefreshOthers;
  437.                 end;
  438.              end;
  439.           end; {MyHindHook}
  440.           {$F-}
  441.  
  442. INSTALLING & REMOVING A HOOK
  443.  
  444.           Having created the hook procedure or function, you must
  445.      instruct Gold to call the routine when the hook event occurs. Refer
  446.      to the hook documentation in the appropriate chapter to determine
  447.      how to install and remove hooks.
  448.  
  449.           In most cases, Gold provides Assign... and Remove...
  450.      procedures for installing and removing hooks. For example, the
  451.      following statement instructs Gold to use the MyHindHook procedure
  452.      (defined above) to the IO hind hook:
  453.  
  454.           AssignHindHook(MyHindHook);
  455.  
  456.           If there is no Remove function, just assign the default hook,
  457.      for example:
  458.  
  459.           AssignHindHook(NoHindHook);
  460.  
  461. Customizing Display Colors
  462.  
  463.           Colors, colors, colors. We get more calls about colors than
  464.      anything. One person's ideal color is another person's anathema. If
  465.      only PCs used green CRT tubes! We have finally realized that we
  466.      cannot please everybody with our default colors. The next best
  467.      thing is to make it easy for you to customize the colors to meet
  468.      your own needs.
  469.  
  470.           The GoldTINT unit is designed to make it very easy for you to
  471.      customize the default colors used in Gold. This unit provides a
  472.      global variable named TINT which defines every color used in Gold.
  473.      You can change a color using the procedure GoldSetColor which is
  474.      defined as follows:
  475.  
  476.           GoldSetColor(Zone:TintElement; Col:byte);
  477.  
  478.           The first parameter identifies the TintElement (see Table
  479.      3.1), and the second attribute is the color byte.
  480.  
  481.           Use the function GoldGetColor to determine the active color
  482.      for a specific tint element.
  483.  
  484.           Gold uses a single byte to define the foreground and
  485.      background colors. Table 3.2 (below) identifies all the supported
  486.      color codes.
  487.  
  488.  
  489.       Table 3.2
  490.  
  491.       Color Codes
  492.  
  493.                        Blk  Blu  Grn  Cyn  Red  Mgt  Brn
  494.            Black         0   16   32   48   64   80   96
  495.            Blue          1   17   33   49   65   81   97
  496.            Green         2   18   34   50   66   82   98
  497.            Cyan          3   19   35   51   67   83   99
  498.            Red           4   20   36   52   68   84  100
  499.            Magenta       5   21   37   53   69   85  101
  500.            Brown         6   22   38   54   70   86  102
  501.            Lt. Gray      7   23   39   55   71   87  103
  502.            Dark Gray     8   24   40   56   72   88  104
  503.            Lt. Blue      9   25   41   57   73   89  105
  504.            Lt. Green    10   26   42   58   74   90  106
  505.            Lt. Cyan     11   27   43   59   75   92  107
  506.            Lt. Red      12   28   44   60   76   92  108
  507.            Lt. Magenta  13   29   45   61   77   93  109
  508.            Yellow       14   30   46   62   78   94  110
  509.            White        15   31   47   63   79   95  111
  510.  
  511.                        Lt.  Dk.  Lt.  Lt.  Lt.  Lt.  Lt.
  512.                        Gry  Gry  Blu  Grn  Cyn  Red  Mgt  Yel  Wht
  513.            Black       112  128  144  160  176  192  208  224  240
  514.            Blue        113  129  145  161  177  193  209  225  241
  515.            Green       114  130  146  162  178  194  210  226  242
  516.            Cyan        115  131  147  163  179  195  211  227  243
  517.            Red         116  132  148  164  180  196  212  228  244
  518.            Magenta     117  133  149  165  181  197  213  229  245
  519.            Brown       118  134  150  166  182  198  214  230  246
  520.            Lt. Gray    119  135  151  167  183  199  215  231  247
  521.            Dark Gray   120  136  152  168  184  200  216  232  248
  522.            Lt. Blue    121  137  153  169  185  201  217  233  249
  523.            Lt. Green   122  138  154  170  186  202  218  234  250
  524.            Lt. Cyan    123  139  155  171  187  203  219  235  251
  525.            Lt. Red     124  140  156  172  188  204  220  236  252
  526.            Lt. Magenta 125  141  157  173  189  205  221  237  253
  527.            Yellow      126  142  158  174  190  206  222  238  254
  528.            White       127  143  159  175  191  207  223  239  255
  529.  
  530.  
  531.           The following example sets the display color of prompt titles
  532.      (in the PromptOK dialogs) to yellow on red:
  533.  
  534.           GoldSetColor(PromptTitle,78);
  535.  
  536.           The GoldATTR unit includes a couple of features which help you
  537.      assign new colors without having to look up values in Table 3.2.
  538.      The unit includes 256 constants which correspond with all the
  539.      possible color combinations. For example, the constant YellowOnRed
  540.      has the value 78 ($4E in hex), and so by including GoldATTR in the
  541.      uses clause, the above example could be simplified to the
  542.      following:
  543.  
  544.           GoldSetColor(PromptTitle,YellowOnRed);
  545.  
  546.           The GoldATTR unit also includes the following procedures and
  547.      functions to assist in handling foreground and background display
  548.      attributes:
  549.  
  550.           CAttr(F,B:byte):byte;
  551.  
  552.           Accepts separate foreground and background attributes, and
  553.      returns the combined attribute byte.
  554.  
  555.      FAttr(A:byte): byte;
  556.  
  557.           Accepts a combined attribute byte, and returns the foreground
  558.      color.
  559.  
  560.           BAttr(A:byte): byte;
  561.  
  562.           Accepts a combined attribute byte, and returns the background
  563.      color.
  564.  
  565. Blinking Colors
  566.  
  567.           On VGA systems, you can use the SetBlinking procedure to
  568.      control whether light background colors are displayed with a
  569.      normal, bright background, or as blinking characters on a dark
  570.      color background. When SetBlinking is passed a TRUE value,
  571.      bright/light background colors will cause the foreground colors to
  572.      blink.
  573.  
  574.           Note that there is a hardware limitation; the blinking state
  575.      applies to the entire display, not to an individual write
  576.      statement. In other words, you cannot have some text with blinking
  577.      characters in one portion of the display, and some other text with
  578.      bright background colors in a different part of the display.
  579.  
  580. Using Custom Characters
  581.  
  582.           On VGA (or better) display systems, Gold uses a technique for
  583.      drawing custom characters to give check boxes, radio buttons and
  584.      windows a special graphical appearance.
  585.  
  586.           You can test whether the display system supports the custom
  587.      characters by calling the function CustomCapable. The function
  588.      returns TRUE if the custom characters are supported, otherwise
  589.      FALSE is returned.
  590.  
  591.           By default, the normal ASCII character set is used. You can
  592.      enable the custom drawing characters by calling the procedure
  593.      UseCustomChars. Behind the scenes, Gold replaces the double-line
  594.      drawing characters with a set of custom characters. So, if you are
  595.      using the custom characters, you sacrifice the double line
  596.      characters. Run the demo program DEMCUST1.PAS to see the character
  597.      substitution.
  598.  
  599.           If, having called UseCustomChars, you do not get the special
  600.      drawing characters, check that the conditional compiler directive
  601.      NOVGACHARS (discussed earlier in this chapter) is not enabled.
  602.  
  603.           Once you have enabled the custom characters, you do not need
  604.      to explicitly build your own boxes and buttons using these
  605.      characters. Gold will automatically apply the new characters to
  606.      windows, etc. provided you have selected a window style that uses
  607.      these characters. See the demo program DEMWIN1.PAS for an example
  608.      of these styles.
  609.  
  610.           You can write an application which takes full advantage of
  611.      custom characters (such as the Gold installation program), and not
  612.      have to worry about how the application will behave on systems
  613.      which do not support these characters. Gold automatically changes
  614.      the display characters so that the application looks professional
  615.      on non-custom character capable systems.
  616.  
  617.           In addition to the standard custom drawing characters, Gold
  618.      offers a special character set for drawing the 12 functions keys.
  619.      Call the procedure UseCustomFunctionKeys to activate these custom
  620.      characters.
  621.  
  622.           Call the procedure RemoveCustomChars to remove the custom
  623.      character set and reinstate the double-line characters.
  624.